package com.group.eams.service.impl;


import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.group.eams.pojo.dto.FlowQueryDto;
import com.group.eams.pojo.entity.Flow;
import com.group.eams.service.FlowService;
import com.group.eams.mapper.FlowMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 恩哲欣
* @description 针对表【flow(流程表)】的数据库操作Service实现
* @createDate 2024-10-29 16:09:34
*/
@Service
public class FlowServiceImpl extends ServiceImpl<FlowMapper, Flow> implements FlowService{

    @Autowired
    private FlowMapper flowMapper;

    /**
     * 根据查询条件查询流程信息
     *
     * @param flowQueryDto 查询条件
     * @return 流程信息
     */
    @Override
    public Page<Flow> findByQueryDto(FlowQueryDto flowQueryDto) {
        Page<Flow> page = new Page<>(flowQueryDto.getPage(),flowQueryDto.getLimit());
        LambdaQueryWrapper<Flow> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(!StrUtil.isEmpty(flowQueryDto.getFlowName()), Flow::getFlowName, flowQueryDto.getFlowName());
        return flowMapper.selectPage(page,queryWrapper);
    }
}
